<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML>
<html>
<head>
  <title>后台管理系统</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link href="/resources/css/dpl-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/bui-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/page-min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">

    <form id="searchForm" class="form-horizontal">
        <div class="row">
            <div class="control-group span8" style="width:250px;">
                <label class="control-label" style="width:80px;">名称：</label>
                <div class="controls" style="width:150px;">
                    <input type="text" class="control-text" name="nickName">
                </div>
            </div>
            <div class="control-group span8"  style="width:250px;">
                <label class="control-label"  style="width:80px;">账号：</label>
                <div class="controls"  style="width:150px;">
                    <input type="text" class="control-text" name="account">
                </div>
            </div>
            <input type="hidden" name="type" value="Customer"/>

            <div class="span3 offset2">
                <button  type="button" id="btnSearch" class="button button-primary">搜索</button>
            </div>
        </div>
    </form>
    <div class="row">
        <div class="control-group span6">
            <label class="control-label">普通消费者现金奖总额：</label>
            <span id="xjjze">
            0
            </span>
        </div>

        <div class="control-group span6">
            <label class="control-label">普通消费者购物奖总额：</label>
            <span  id="gwjze">
            0
        </span>元
        </div>
    </div>
    <div class="search-grid-container">
        <div id="grid"></div>
    </div>
</div>
<script type="text/javascript" src="/resources/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="/resources/js/bui-min.js"></script>
<script type="text/javascript" src="/resources/js/config-min.js"></script>
<script type="text/javascript">
    var store,gridCfg;
  BUI.use(['common/search','common/page','bui/grid','bui/overlay','bui/form'],function (Search,Page,Grid,Overlay,Form) {
    var  columns = [
              {title:'用户编号',dataIndex:'userAccount',width:150},
              {title:'用户名称',dataIndex:'userName',width:150},
              {title:'用户类型',dataIndex:'userName',width:120,renderer:function(value,obj){
                if(obj.userType=='Gold'){
                    return "金牌代理商";
                }else if(obj.userType=='General'){
                    return "全国总代";
                }else if(obj.userType=='Partner'){
                    return "区域合伙人";
                }else if(obj.userType=='Customer'){
                    return "普通消费者";
                }
              }},
             {title:'现金奖',dataIndex:'cash',width:80},
             {title:'购物奖',dataIndex:'bonus',width:80},
             {title:'冻结金额',dataIndex:'frozenAmount',width:80},
              {title:'操作',dataIndex:'',width:200,renderer : function(value,obj){
                var viewStr =  Search.createLink({ //链接使用 此方式
                          id : 'view' + obj.id,
                          title : '查看明细',
                          text : '查看明细',
                          href : '/userAmount/viewdetail?id='+obj.userId
                        });

                  var editStr =  Search.createLink({ //链接使用 此方式
                      id : 'edit' + obj.userId,
                      title : '调整金额：'+obj.userName,
                      text : '调整金额',
                      href : '/userAmount/viewAmount?id='+obj.id
                  });
                //+editStr+delStr;
                return viewStr+editStr;
              }}
            ];
            store = Search.createStore('/userAmount/listData');
            gridCfg = Search.createGridCfg(columns,{

              plugins : [BUI.Grid.Plugins.CheckSelection] // 插件形式引入多选表格
            });

  });
    $(function(){
        loadData();
    });
    function loadData(){
        $.ajax({
            url:"/memberAmount/loadData?r="+Math.random(),
            type:"post",
            data:{
                type:"0"
            },
            success:function(res){
                if(res.success){
                    $("#xjjze").html(res.data.xjjye);
                    $("#gwjze").html(res.data.gwjye);
                }
            },
            error:function(){}
        })
    }
</script>
<script type="text/javascript" src="/views/js/list.js"></script>
</body>
</html>  
